const { DataTypes } = require('sequelize');
const { sequelize } = require('../init'); // 导入数据库连接配置

// 通信记录表
const CommunicationLog = sequelize.define('CommunicationLog', {
    LogID: {
        type: DataTypes.INTEGER,
        primaryKey: true,
        autoIncrement: true,
    },
    WorkOrderID: {
        type: DataTypes.STRING,
        allowNull: false,
    },
    LogDate: {
        type: DataTypes.DATE,
        allowNull: true,
    },
    UserID: {
        type: DataTypes.STRING,
        allowNull: false,
    },
    LogContent: {
        type: DataTypes.STRING,
        defaultValue: DataTypes.NOW,
    },
}, {
    tableName: 'communicationlog', // 显式指定表名为 "communicationlog"
    timestamps: false, // 如果表中不包含 createdAt 和 updatedAt 字段，请将此选项设置为 false
    collate: 'utf8mb4_bin' // 设置字符集规则
});
// 帮我打印一下数据库连接情况
CommunicationLog.sync({ force: false }).then(() =>
{
    console.log('通信记录表准备');
});
module.exports = { CommunicationLog };
